<div id="package-equipment" style="height: 100%">

</div>
<script type="text/javascript">
    var myChart = echarts.init(document.getElementById('package-equipment'), 'macarons');

    option = {
        title : {
            text: '包装设备工作时间闲忙',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        series : [
            {
                name: '包装设备工作时间闲忙',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[
                    {value:198, name:'闲'},
                    {value:220, name:'忙'}
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    },
                    normal: {
                        //好，这里就是重头戏了，定义一个list，然后根据所以取得不同的值，这样就实现了，
                        color: function(params) {
                            // build a color map as your need.
                            var colorList = [
                                '#0fa99d','#d9d9d9','#4472c4','#c9eee7','#e7a14c',
                                '#787473','#9BCA63','#FAD860','#F3A43B','#60C0DD',
                                '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
                            ];
                            return colorList[params.dataIndex]
                        },
                        //以下为是否显示，显示位置和显示格式的设置了
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
</script>